<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Protocols  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>
    <script src="js/jquery.min.js" defer></script>
    <script src="js/jazzy.js" defer></script>
    
  </head>
  <body>
    <a title="Protocols  Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="index.html">Spruce Docs</a> (100% documented)</p>
        <p class="header-right"><a href="https://github.com/willowtreeapps/spruce-ios"><img src="img/gh.png"/>View on GitHub</a></p>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="index.html">Spruce Reference</a>
        <img id="carat" src="img/carat.png" />
        Protocols  Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Classes/Button.html">Button</a>
              </li>
              <li class="nav-group-task">
                <a href="Classes/ViewController.html">ViewController</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Enums.html">Enums</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Enums/Angle.html">Angle</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Corner.html">Corner</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Direction.html">Direction</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Distance.html">Distance</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Position.html">Position</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Scale.html">Scale</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/SlideDirection.html">SlideDirection</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/StockAnimation.html">StockAnimation</a>
              </li>
              <li class="nav-group-task">
                <a href="Enums/Weight.html">Weight</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Extensions/CGPoint.html">CGPoint</a>
              </li>
              <li class="nav-group-task">
                <a href="Extensions/UIView.html">UIView</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Protocols/Animation.html">Animation</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/CornerSortFunction.html">CornerSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/DirectionSortFunction.html">DirectionSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/PositionSortFunction.html">PositionSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/SortFunction.html">SortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/View.html">View</a>
              </li>
              <li class="nav-group-task">
                <a href="Protocols/WeightSortFunction.html">WeightSortFunction</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="Structs.html">Structs</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="Structs/ContinuousSortFunction.html">ContinuousSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/ContinuousWeightedSortFunction.html">ContinuousWeightedSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/CorneredSortFunction.html">CorneredSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/DefaultSortFunction.html">DefaultSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/InlineSortFunction.html">InlineSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/LinearSortFunction.html">LinearSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RadialSortFunction.html">RadialSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/RandomSortFunction.html">RandomSortFunction</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/SpringAnimation.html">SpringAnimation</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/Spruce.html">Spruce</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/SprucePoint.html">SprucePoint</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/SpruceUIView.html">SpruceUIView</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs/StandardAnimation.html">StandardAnimation</a>
              </li>
              <li class="nav-group-task">
                <a href="Structs.html#/s:V6Spruce9TimedView">TimedView</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Protocols</h1>
            <p>The following protocols are available globally.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce21DirectionSortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/DirectionSortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce21DirectionSortFunction">DirectionSortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></code> that defines it&rsquo;s <code>distancePoint</code> based on a <code><a href="Enums/Direction.html">Direction</a></code>. Any distance based sort functions that use a direction variable in order to determine the setup of the animation should implement this protocol.</p>

                        <a href="Protocols/DirectionSortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DirectionSortFunction</span><span class="p">:</span> <span class="kt"><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce20DistanceSortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/DistanceSortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce20DistanceSortFunction">DistanceSortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/SortFunction.html">SortFunction</a></code> implementation that contain basic methods needed for doing distance comparisons. If you are implementing a <code><a href="Protocols/SortFunction.html">SortFunction</a></code> that considers distance to be one of it&rsquo;s weighting mechanisms for sorting the views on the screen, then implementing this protocol would provide improvements over the standard <code><a href="Protocols/SortFunction.html">SortFunction</a></code>.</p>

                        <a href="Protocols/DistanceSortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DistanceSortFunction</span><span class="p">:</span> <span class="kt"><a href="Protocols/SortFunction.html">SortFunction</a></span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce12SortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/SortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce12SortFunction">SortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>For all the views on the screen, we need to find some way of organizing them so that when we start the animation, each view will know when to start their individual animation. The concept of a <code>SortFunction</code> is just that. Given a view, the subviews of that view are sorted in a way that when animated they resemble the nature of that sort function. There are many different types of sort functions because there are so many ways to sort the subviews that are on the screen. If you don&rsquo;t see a stock one that fits your need, feel free to implement this protocol and use your own custom <code>SortFunction</code> with Spruce.</p>

                        <a href="Protocols/SortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">SortFunction</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce4View"></a>
                    <a name="//apple_ref/swift/Protocol/View" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce4View">View</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Used to keep track of the <code>UIView</code> object and a changing reference point. Since Spruce allows for
recursive subview lookup, we need to handle changing the coordinate space. Once the coordinate space
has been accounted for we can then alter the reference point.</p>

                        <a href="Protocols/View.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">View</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce9Animation"></a>
                    <a name="//apple_ref/swift/Protocol/Animation" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce9Animation">Animation</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>An animation type that handles how the views will change. Most of these are simply wrappers around the standard <code>UIViewAnimation</code> methods. This gives <code><a href="Structs/Spruce.html">Spruce</a></code> the flexibility to work with any style of animating.</p>

                        <a href="Protocols/Animation.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Animation</span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce20PositionSortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/PositionSortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce20PositionSortFunction">PositionSortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></code> that uses a position attribute to define an animation&rsquo;s starting point.</p>

                        <a href="Protocols/PositionSortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">PositionSortFunction</span><span class="p">:</span> <span class="kt"><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce18WeightSortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/WeightSortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce18WeightSortFunction">WeightSortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/SortFunction.html">SortFunction</a></code> that takes into account the vertical and horizontal weight of the position of views. The lighter the weight the the faster those views will start to animate. For example, if you had a light <code>verticalWeight</code> and a heavy <code>horizontalWeight</code>, the views that are vertically aligned with the starting position will animate before those that are horizontally aligned. This allows you to define the exact rigidness of a <code>radial</code> like <code><a href="Protocols/SortFunction.html">SortFunction</a></code>.</p>

                        <a href="Protocols/WeightSortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">WeightSortFunction</span><span class="p">:</span> <span class="kt"><a href="Protocols/SortFunction.html">SortFunction</a></span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:P6Spruce18CornerSortFunction"></a>
                    <a name="//apple_ref/swift/Protocol/CornerSortFunction" class="dashAnchor"></a>
                    <a class="token" href="#/s:P6Spruce18CornerSortFunction">CornerSortFunction</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>A <code><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></code> that uses a corner attribute to define an animation&rsquo;s starting point.</p>

                        <a href="Protocols/CornerSortFunction.html" class="slightly-smaller">See more</a>
                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">CornerSortFunction</span><span class="p">:</span> <span class="kt"><a href="Protocols/DistanceSortFunction.html">DistanceSortFunction</a></span></code></pre>

                        </div>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2017 <a class="link" href="https://willowtreeapps.com" target="_blank" rel="external">WillowTree</a>. All rights reserved. (Last updated: 2017-03-10)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</div>
</html>
